易搜[搜].js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /**
  2. * 解密json数据中的url
  3. * @param url
  4. * @returns {*}
  5. */
  6. function decrypt(url) {
  7. let key = CryptoJS.enc.Utf8.parse("4OToScUFOaeVTrHE");
  8. let iv = CryptoJS.enc.Utf8.parse("9CLGao1vHKqm17Oz");
  9. let encrypted = CryptoJS.AES.decrypt({
  10. ciphertext: CryptoJS.enc.Base64.parse(url)
  11. }, key, {
  12. iv: iv,
  13. mode: CryptoJS.mode.CBC,
  14. padding: CryptoJS.pad.Pkcs7
  15. }).toString(CryptoJS.enc.Utf8);
  16. return encrypted;
  17. }
  18. /**
  19. * 自动输入验证码并登录成功获取cookie
  20. * @returns {`satoken=${*};${string}`|string}
  21. */
  22. function verifyLogin() {
  23. let cnt = 0;
  24. let cookie = '';
  25. let yzm_url = 'https://yiso.fun/api/user/login/captcha';
  26. log(`验证码链接:${yzm_url}`);
  27. let submit_url = 'https://yiso.fun/api/user/login';
  28. log(`post登录链接:${submit_url}`);
  29. while (cnt < OCR_RETRY) {
  30. try {
  31. let {cookie, html} = reqCookie(yzm_url, {toBase64: true});
  32. let code = OcrApi.classification(html);
  33. log(`第${cnt + 1}次验证码识别结果:${code}`);
  34. html = post(submit_url, {
  35. headers: {Cookie: cookie},
  36. body: {
  37. "userName": 'hjdhnx1',
  38. "password": 'Dz@hjdhnx1',
  39. "code": code
  40. }
  41. });
  42. html = JSON.parse(html);
  43. if (html.code === 200) {
  44. let tokenValue = html.data.tokenValue;
  45. log(`第${cnt + 1}次验证码提交成功`);
  46. cookie = `satoken=${tokenValue};${cookie}`
  47. return cookie // 需要返回cookie
  48. } else if (html.code !== 200 && cnt + 1 >= OCR_RETRY) {
  49. cookie = ''; // 需要清空返回cookie
  50. }
  51. } catch (e) {
  52. log(`第${cnt + 1}次验证码提交失败:${e.message}`);
  53. if (cnt + 1 >= OCR_RETRY) {
  54. cookie = '';
  55. }
  56. }
  57. cnt += 1
  58. }
  59. return cookie
  60. }
  61. globalThis.decrypt = decrypt;
  62. globalThis.verifyLogin = verifyLogin;
  63. var rule = {
  64. title: '易搜[搜]',
  65. host: 'https://yiso.fun',
  66. searchUrl: '/api/search?name=**',
  67. searchable: 2,
  68. quickSearch: 0,
  69. headers: {'User-Agent': 'PC_UA'},
  70. timeout: 10000,
  71. play_parse: true,
  72. lazy: $js.toString(() => {
  73. let url = input.startsWith('push://') ? input : 'push://' + input;
  74. input = {parse: 0, url: url};
  75. }),
  76. // 一级: '',
  77. 二级: '*',
  78. 搜索: $js.toString(() => {
  79. let cookie = getItem(RULE_CK, '');
  80. log('储存的cookie:' + cookie);
  81. let ret = request(MY_URL, {
  82. headers: {
  83. Referer: encodeUrl(`https://yiso.fun/info?searchKey=${KEY}`),
  84. Cookie: cookie,
  85. }
  86. });
  87. if (/登录用户无限制/.test(ret)) {
  88. log(ret);
  89. cookie = verifyLogin();
  90. if (cookie) {
  91. log(`本次成功过验证,cookie:${cookie}`);
  92. setItem(RULE_CK, cookie);
  93. } else {
  94. log(`本次自动过搜索验证失败,cookie:${cookie}`);
  95. }
  96. ret = request(MY_URL, {
  97. headers: {
  98. Referer: encodeUrl(`https://yiso.fun/info?searchKey=${KEY}`),
  99. Cookie: cookie,
  100. }
  101. });
  102. }
  103. let d = [];
  104. let arr = JSON.parse(ret).data.list;
  105. arr.forEach(it => {
  106. let u = decrypt(it.url);
  107. if (u && u.includes('ali')) {
  108. d.push({
  109. title: it.fileInfos[0].fileName,
  110. url: u,
  111. desc: (it.gmtShare || it.gmtCreate) + "\n" + (u),
  112. content: u,
  113. });
  114. }
  115. });
  116. setResult(d);
  117. }),
  118. }